package GUI;

import javax.swing.*;
import java.awt.*;

public class successfulLog extends JFrame implements Runnable{
    JPanel panel = new JPanel(new GridLayout(4, 1,20,20));

    JLabel successLab=new JLabel();
    JLabel lab2=new JLabel(" ");
    static successfulLog successful;

    public successfulLog(){}

    public successfulLog(String a){
        this.setSize(200,150);
        Font bigFont = new Font("sanserif",Font.PLAIN,15);

        Runnable r =new Runnable() {
                    @Override
                    public void run() {
                        String a="登录成功！";
                        successLab.setText(a);
                        successLab.setFont(bigFont);
                        panel.setSize(successfulLog.this.getSize());
                        panel.add(lab2);
                        panel.add(successLab);
                        successfulLog.this.getContentPane().add(BorderLayout.CENTER,panel);
                        successfulLog.this.setLayout(new FlowLayout());//流式布局
                        successfulLog.this.setLocationRelativeTo(null);//居中

                        successfulLog.this.setTitle("在线考试平台");
                        successfulLog.this.setVisible(true);
                        //this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                    }
        };
        Thread t=new Thread(r);
        t.run();
        /*while(!successLab.getText().equals("")){
            try {
            t.sleep(5000);
            successfulLog.this.dispose();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }}*/this.requestFocus();
    }
    @Override
    public void run(){
        new successfulLog("a");
    }
}

